import 'package:banquanjie_app/app/services/screenAdapter.dart';
import 'package:flutter/material.dart';
class EliteCardList extends StatelessWidget {
  final Map item;
  const EliteCardList({super.key, required this.item});
  @override
  Widget build(BuildContext context) {
    return Container(
      width: ScreenAdapter.width(710),
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.all(Radius.circular(8)),
      ),
      child: Column(
        children: [
          Stack(
            children: [
              Padding(
                padding: EdgeInsets.fromLTRB(ScreenAdapter.width(30), ScreenAdapter.width(30), ScreenAdapter.width(50), ScreenAdapter.width(18)),
                child: Row(
                  crossAxisAlignment: CrossAxisAlignment.center,
                  children: [
                    Container(
                      margin: EdgeInsets.only(right: ScreenAdapter.width(28)),
                      width: ScreenAdapter.width(152),
                      height: ScreenAdapter.width(152),
                      child:  Stack(
                        children: [
                          //  <image class="cover" mode="aspectFill" :src="item.headOssUrl"></image>
                      // <image class="auth_icon" src=""></image>
                          ClipOval(
                            child: Image.network(
                              item['headOssUrl'],
                              width: ScreenAdapter.width(152),
                              height: ScreenAdapter.width(152),
                              fit: BoxFit.cover
                            )
                          ),
                          Align(
                            alignment: Alignment(1, 1),
                            child: ClipRRect(
                              child: Image.network(
                                'https://zsjl.oss-cn-beijing.aliyuncs.com/test/xcx/auth_icon.png',
                                width: ScreenAdapter.width(30),
                                height: ScreenAdapter.width(30),
                                fit: BoxFit.cover
                              )
                            )
                          )
                        ]
                      ),
                    ),
                    Expanded(
                      flex: 1,
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: [
                          Text('${item['userName']}', style: TextStyle(height: 1,fontSize: ScreenAdapter.fontSize(30), color: Color(0xFF000000))),
                          SizedBox(height: ScreenAdapter.width(20)),
                          if (item['occupationName'] != null)
                            Row(
                              children: [
                                for(int i = 0; i < item['occupationName'].split(',').length; i++)
                                  Container(
                                    height: ScreenAdapter.fontSize(24) * 1.25,
                                    margin: EdgeInsets.only(right: ScreenAdapter.width(6)),
                                    padding: EdgeInsets.symmetric(horizontal: ScreenAdapter.width(4)),
                                    constraints: BoxConstraints(
                                      minWidth: ScreenAdapter.width(58),
                                      // maxWidth: ScreenAdapter.width(58)
                                    ),
                                    decoration: BoxDecoration(
                                      color: Color(0xFFF0F2F5),
                                      borderRadius: BorderRadius.circular(ScreenAdapter.width(4)),
                                    ),
                                    clipBehavior: Clip.antiAlias,
                                    child: Text(
                                      '${item['occupationName'].split(',')[i]}', 
                                      overflow: TextOverflow.ellipsis, 
                                      maxLines: 1, 
                                      style: TextStyle(
                                        height: 1.25, 
                                        fontSize: ScreenAdapter.fontSize(24), 
                                        color: Color(0xFF000000)
                                      )
                                    )
                                  )
                              ]
                            ),
                          SizedBox(height: ScreenAdapter.height(8)),
                          Text('代表作：${item['reprWorks'] != null && item['reprWorks'].isNotEmpty ? item['reprWorks'] : "暂无代表作" }', style: TextStyle(height: 11 / 7, fontSize: ScreenAdapter.fontSize(28),color: Colors.black)),
                        ]
                      )
                    )
                  ]
                )
              ),
              Positioned(
                right: ScreenAdapter.width(20),
                top: ScreenAdapter.width(20),
                child: ClipOval(
                  child: Image.network(
                    'https://zsjl.oss-cn-beijing.aliyuncs.com/test/xcx/mobile_icon.png', 
                    width: ScreenAdapter.width(68), 
                    height: ScreenAdapter.width(68), 
                    fit: BoxFit.cover
                  )
                )
              )
            ]
          ),
          
          Container(
            padding: EdgeInsets.only(left: ScreenAdapter.width(30), right: ScreenAdapter.width(22)),
            height: ScreenAdapter.width(78),
            decoration: BoxDecoration(
              border: Border(top: BorderSide(color: Color(0xffF4F7FC), width: 1))
            ),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                RichText(
                  text: TextSpan(
                    style: TextStyle(
                      height: 1.9,
                      fontSize: ScreenAdapter.fontSize(22), 
                      color: Color(0xFF000000),
                      leadingDistribution: TextLeadingDistribution.even
                    ),
                    children: [
                      WidgetSpan(
                        alignment: PlaceholderAlignment.middle,
                        child: Image.network(
                          'https://zsjl.oss-cn-beijing.aliyuncs.com/test/xcx/love_icon.png',
                          width: ScreenAdapter.width(20),
                          height: ScreenAdapter.width(18),
                          fit: BoxFit.cover
                        )
                      ),
                      TextSpan(text: " ${item['collectNum']} | "),
                      TextSpan(text: "${item['cityName']}"),
                    ]
                  )
                ),
                SizedBox(
                  width: ScreenAdapter.width(108),
                  height: ScreenAdapter.width(50),
                  child: ElevatedButton(
                    onPressed: () {},
                    style: ButtonStyle(
                      padding: WidgetStatePropertyAll(EdgeInsets.all(0)),
                      backgroundColor: WidgetStateProperty.all(Color(0xff00b277)),
                      foregroundColor: WidgetStateProperty.all(Colors.white),
                      shape: WidgetStateProperty.all(RoundedRectangleBorder(borderRadius: BorderRadius.circular(ScreenAdapter.width(6))))
                    ),
                    child: Text('关注', style: TextStyle(fontSize: ScreenAdapter.fontSize(26)))
                  )
                )
              ],
            )
          )
          
        ]
      )
    );
  }
  
}